<?php 

class album{
	
	private $db;
	public $album_id;
	public $album_name;
	
	function __construct($wpdb){
		$this->db = $wpdb;	
	}
	
	function configAlbum($album_id){
		$query = "SELECT album_id, album_name FROM flickr_albums WHERE album_id = $album_id";
		$row = $this->db->get_row($query);
		$this->album_id = $row->album_id;
		$this->album_name = $row->album_name;
	}
	
	function newAlbum($name){
		$this->db->insert('flickr_albums', array('album_name' => $name));
	}
	
	function getAlbumsList(){?>
		<li class="all selected"><a href="#">All Photos</a></li>
		<?php		
		$albums_query = "SELECT 
    						album_id, 
    						album_name 
    					FROM 
    						flickr_albums";
        $albums=$this->db->get_results($albums_query);
        foreach ($albums as $album){
            ?>
            <li id="a_<?php echo $album->album_id;?>" >
            	<a href="#"><?php echo $album->album_name; ?></a>
            </li>
            <?php
        }
	}
	
}
?>